﻿<!DOCTYPE html>
<html>
<head>
    <title>相册列表</title>
    <meta charset="UTF-8">
    <link rel="icon" href="/assets/zw-ico.jpg">
    <div th:include="header::headPart"></div>
    <div th:include="album/albumHeader::listJS"></div>
	<script th:inline="javascript">

		$(document).ready(function() {
			init();
			xmore();
		});
		
		var router = "/albumfen";
		var sitename = "风";
		
		var keyword = [[${param.who}]];
		if(keyword) {
			pageParam = keyword;
			sitename += keyword;
		}
		
		function insertTable(meat) {
			console.log(meat);
			var albums = meat.photos;
			for(var myi = 0; myi < albums.length; myi++) {
				var item = albums[myi];
				var title = item.title;
				var albumurl = item.href;
				var coverurl = item.cover;
				var tags = item.tags;
				
				var td = tdOfBreakword();
				
				var labor = labelOf("#").addClass("mylabor label-primary")
				td.append(labor);
				td.append(knbsp(2));
				
				var labelCount = labelOf("?张").addClass("label-default");
				labelCount.click(getImageCount);
				labelCount.css("cursor", "pointer");
				td.append(labelCount);
				td.append(knbsp(2));
				var ak = anchorOf(title, router + "/show/" + base64(albumurl));
				td.append(ak);
				
				if(tags) {
					console.log(tags);
					td.append("<br>");
					
					//all
					{
						var labelTag = labelOf("雨全").addClass("label-danger");
						labelTag.css("cursor", "pointer");
						labelTag.click(function() {
							var homeurl = "/albummay/words";
							window.open(homeurl);
						});
						td.append(labelTag).append(knbsp(1));
					}
					//all

					
					var who = [[${param.who}]];

					for(var key in tags){
						var name = tags[key];
						var style = "label-default";
						var iscurrent = who == name;
						if(iscurrent) {
							style = "label-success";
						}
						var labelTag = labelOf(name).addClass(style);
						if(!iscurrent) {
							labelTag.css("cursor", "pointer");
							labelTag.data("myname", name);
							labelTag.click(function() {
								var text = $(this).text();
								var myname = $(this).data("myname");
								var homeurl = router + "/list?who=" + encodeURI(myname);
								window.open(homeurl);
							});
						}
						td.append(labelTag).append(knbsp(1));
					}
				}
				
				var image = $("<img></img>").attr("alt", "<点击加载封面>");
				image.addClass("dog").css("max-width", "100%");
				image.attr("data-mypath", coverurl);
				image.attr("data-albumurl", albumurl);
				image.click(function() {
					var current = $(this);

					var status = current.attr("status");
					if(status != null) {
						var albumurl = current.data("albumurl");
						var href = router + "/show/" + base64(albumurl);
						window.open(href, "_blank");
					} else {
						var status = current.attr("status");
						current.attr("alt", "<正在加载封面...>");
						var myPath = current.data("mypath");
				        loadImage(this, myPath, showImage);
				        current.attr("status", "full");
				        current.css("cursor", "pointer");
					}
				});
				image.click();
				td.append("<br>").append(image);
				
				var tr = $("<tr></tr>").append(td);
				$("#list").append(tr);

				//donation area
				if(myi == albums.length - 1) {
					$("#list").append(trOfDonation());
				}
				//donation area
			}
		}
	</script>
</head>

<body>
	<div th:replace="header::bodyHead"></div>
		<div class="margin10">
			<div th:include="album/albumHeader::listHolder"></div>
	    </div>
	<div th:replace="footer::copyright"></div>
</body>
</html>